<?php

/**
 * Familiar form base class.
 *
 * @method Familiar getObject() Returns the current form's model object
 *
 * @package    sibi-salud
 * @subpackage form
 * @author     SIBI <sibiud@gmail.com>
 */
abstract class BaseFamiliarForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'parentesco_id'      => new sfWidgetFormPropelChoice(array('model' => 'Parentesco', 'add_empty' => true)),
      'persona_usuario_id' => new sfWidgetFormPropelChoice(array('model' => 'Persona', 'add_empty' => false)),
      'persona_id'         => new sfWidgetFormPropelChoice(array('model' => 'Persona', 'add_empty' => true)),
      'acudiente'          => new sfWidgetFormInputCheckbox(),
      'ocupacion'          => new sfWidgetFormInputText(),
      'escolaridad'        => new sfWidgetFormInputText(),
      'relacion'           => new sfWidgetFormInputText(),
      'id'                 => new sfWidgetFormInputHidden(),
    ));

    $this->setValidators(array(
      'parentesco_id'      => new sfValidatorPropelChoice(array('model' => 'Parentesco', 'column' => 'id', 'required' => false)),
      'persona_usuario_id' => new sfValidatorPropelChoice(array('model' => 'Persona', 'column' => 'id')),
      'persona_id'         => new sfValidatorPropelChoice(array('model' => 'Persona', 'column' => 'id', 'required' => false)),
      'acudiente'          => new sfValidatorBoolean(array('required' => false)),
      'ocupacion'          => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'escolaridad'        => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'relacion'           => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'id'                 => new sfValidatorPropelChoice(array('model' => 'Familiar', 'column' => 'id', 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('familiar[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Familiar';
  }


}
